'\" te
'\"! tbl | eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 copycolor
.ds Xs 49586 7 copycolortable.gl
.TH GLCOPYCOLORTABLE 3G
.SH NAME
.B "glCopyColorTable
\- copy pixels into a color table

.SH C SPECIFICATION
void \f3glCopyColorTable\fP(
GLenum \fItarget\fP,
.nf
.ta \w'\f3void \fPglCopyColorTable( 'u
	GLenum \fIinternalformat\fP,
	GLint \fIx\fP,
	GLint \fIy\fP,
	GLsizei \fIwidth\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIinternalformat\fP\ \ 'u 
\f2target\fP
The color table target. Must be
\%\f3GL_COLOR_TABLE\fP,
\%\f3GL_POST_CONVOLUTION_COLOR_TABLE\fP,
or \%\f3GL_POST_COLOR_MATRIX_COLOR_TABLE\fP.
.TP
\f2internalformat\fP
The internal storage  of the texture image.
Must be one of the following symbolic constants:
\%\f3GL_ALPHA\fP,
\%\f3GL_ALPHA4\fP,
\%\f3GL_ALPHA8\fP,
\%\f3GL_ALPHA12\fP,
\%\f3GL_ALPHA16\fP,
\%\f3GL_LUMINANCE\fP,
\%\f3GL_LUMINANCE4\fP,
\%\f3GL_LUMINANCE8\fP,
\%\f3GL_LUMINANCE12\fP,
\%\f3GL_LUMINANCE16\fP,
\%\f3GL_LUMINANCE_ALPHA\fP,
\%\f3GL_LUMINANCE4_ALPHA4\fP,
\%\f3GL_LUMINANCE6_ALPHA2\fP,
\%\f3GL_LUMINANCE8_ALPHA8\fP,
\%\f3GL_LUMINANCE12_ALPHA4\fP,
\%\f3GL_LUMINANCE12_ALPHA12\fP,
\%\f3GL_LUMINANCE16_ALPHA16\fP,
\%\f3GL_INTENSITY\fP,
\%\f3GL_INTENSITY4\fP,
\%\f3GL_INTENSITY8\fP,
\%\f3GL_INTENSITY12\fP,
\%\f3GL_INTENSITY16\fP,
\%\f3GL_R3_G3_B2\fP,
\%\f3GL_RGB\fP,
\%\f3GL_RGB4\fP,
\%\f3GL_RGB5\fP,
\%\f3GL_RGB8\fP,
\%\f3GL_RGB10\fP,
\%\f3GL_RGB12\fP,
\%\f3GL_RGB16\fP,
\%\f3GL_RGBA\fP,
\%\f3GL_RGBA2\fP,
\%\f3GL_RGBA4\fP,
\%\f3GL_RGB5_A1\fP,
\%\f3GL_RGBA8\fP,
\%\f3GL_RGB10_A2\fP,
\%\f3GL_RGBA12\fP,
\%\f3GL_RGBA16\fP.
.TP
\f2x\fP
The x coordinate of the lower-left corner of the pixel rectangle
to be transferred to the color table.
.TP
\f2y\fP
The y coordinate of the lower-left corner of the pixel rectangle
to be transferred to the color table.
.TP
\f2width\fP
The width of the pixel rectangle.
.SH DESCRIPTION
\%\f3glCopyColorTable\fP loads a color table with pixels from the current
\%\f3GL_READ_BUFFER\fP (rather than from main memory, as is the case for
\%\f3glColorTable\fP).
.P
The screen-aligned pixel rectangle with lower-left corner at (\f2x\fP,\ \f2y\fP)
having width \f2width\fP and height 1
is loaded into the color table. If any pixels within
this region are outside the window that is associated with the GL
context, the values obtained for those pixels are undefined.
.P
The pixels in the rectangle are processed just as if
\%\f3glReadPixels\fP were called, with \f2internalformat\fP set to RGBA, 
but processing stops after the final conversion to RGBA.
.P
The four scale parameters and the four bias parameters that are defined
for the table are then used to scale and bias the R, G, B, and A components
of each pixel. The scale and bias parameters are set by calling
\%\f3glColorTableParameter\fP.
.P
Next, the R, G, B, and A values are clamped to the range [0,1].
Each pixel is then converted to the internal  specified by
\f2internalformat\fP. This conversion simply maps the component values of the pixel (R, G, B,
and A) to the values included in the internal  (red, green, blue,
alpha, luminance, and intensity).  The mapping is as follows:
.P
.TS
center;
lb cb cb cb cb cb cb
l c c c c c c.
_
Internal Format	Red	Green	Blue	Alpha	Luminance	Intensity
_
\%\f3GL_ALPHA\fP				A
\%\f3GL_LUMINANCE\fP					R
\%\f3GL_LUMINANCE_ALPHA\fP				A	R
\%\f3GL_INTENSITY\fP						R
\%\f3GL_RGB\fP	R	G	B
\%\f3GL_RGBA\fP	R	G	B	A
_
.TE
.P
Finally, the red, green, blue, alpha, luminance, and/or intensity components of
the resulting pixels are stored in the color table.
They form a one-dimensional table with indices in the range
[0,\ \f2width\fP\ \-\ 1].
.P
.SH NOTES
\%\f3glCopyColorTable\fP is available only if \%\f3GL_ARB_imaging\fP is returned from calling
\%\f3glGetString\fP with an argument of \%\f3GL_EXTENSIONS\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated when \f2target\fP is not one of the
allowable values.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2width\fP is less than zero.
.P
\%\f3GL_INVALID_VALUE\fP is generated if \f2internalformat\fP is not one of the
allowable values.
.P
\%\f3GL_TABLE_TOO_LARGE\fP is generated if the requested color table
is too large to be supported by the implementation.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glCopyColorTable\fP is executed
between the execution of \%\f3glBegin\fP and the corresponding
execution of \%\f3glEnd\fP.
.SH ASSOCIATED GETS
\%\f3glGetColorTable\fP,
\%\f3glGetColorTableParameter\fP
.SH SEE ALSO
\%\f3glColorTable(3G)\fP,
\%\f3glColorTableParameter(3G)\fP,
\%\f3glReadPixels(3G)\fP
